package top.hkyzf.study.leetcode.bit;

import org.junit.Test;

/**
 * @author 朱峰
 * @date 2022-1-31 11:06
 */
public class _2的幂_231 {
    public boolean isPowerOfTwo(int n) {
        return (n>0) && (n & (n-1)) == 0;
    }

    @Test
    public void testIsPowerOfTwo () {
        int n = 1;
        System.out.println(isPowerOfTwo(n));
    }
}
